// 域名
// const HOST_URI = 'https://mds-zx2-local.qeeka.com/mobile-designer-service/';
// const HOST_URI = 'https://mob-designer-zxpt-api.m.jia.com/mobile-designer-service/';
const HOST_URI = 'https://www.mifashop.cn/api/';

//首页banner
const INDEX_BANNER = 'ad/indexBanner';

// 商品分类
const GOODS_CLASS = 'goods/goodClass';

// 商品列表
const GOODS_LIST = 'goods/goods';

// 商品详情
const GOODS_DETAIL = 'goods/goodsDetail';

// 相关单品
const GOODS_RELATED = 'goods/relatedGoods';

// 热门搜索关键词
const HOT_WORD = 'goods/hotWord';

// 首页拼团
const INDEX_GROUP = 'group/indexList';

// 拼团列表
const GROUP_LIST = 'group/getList';

// 首页热门推荐
const GOODS_INDEX_RECOMMEND = 'goods/indexRecommend';

// 热门推荐列表
const RECOMMEND_LIST = 'goods/recommendList';

// 折扣列表
const PROM_LIST = 'goods/promList';

const PROM_DETAIL = 'goods/promDetail';

const PROM_GOODS = 'goods/promGoods';

const GOODS_SEARCH_TYPE = 'goods/getGoodsSearchType';

const GET_SESSION_KEY = 'auth/getsessionkey';

const GET_USER_FOR_OPENID = 'auth/getUserOpenId';

const WX_PAY = 'pay/dowxpay';

const DEL_SHOP_CAR = 'goods/cartDelete';

// 登录
const LOGIN = 'auth/login';

const CAR_INFO = 'goods/car';

const ADDRESS_EDIT = 'user/addressEdit';

const REGION = 'goods/getRegion';

const USER_ADDRESS = 'user/addressList';

const ADDRESS_DELETE = 'user/addressDelete';

const PLACE_ORDER= 'user/placeOrder';

const GOODS_ADD_CAR= 'goods/addCar';

const ORDER_LIST = 'order/getList';

const ORDER_DETAIL = 'order/getDetail';

const ORDER_CANCEL = 'order/cancelOrder';

const ORDER_CONFIRM = 'order/confirm';

const COUPON_LIST = 'user/couponList';

const CAR_NUM = 'goods/carNum';

const SPECIAL_LIST = 'special/getList';

const SPECIAL_DETAIL = 'special/getDetail';

const SPECIAL_GOODS = 'special/getGoods';

// 订单(客户列表)
const CUSTOMER_LIST = 'customer/list';

// 订单详情(客户详情)
const CUSTOMER_DETAIL = 'customer/detail/';

// 设计师接单
const PICK_ORDER = 'customer/pick/order/';

const PUSH_ORDER_LIST = 'push-order/list-all';

// 获取客户电话
const CUSTOMER_PHONE = 'customer/call?customerId=';

// 获取申请废单选项
const CANCEL_ORDER_OPTIONS = 'customer/order/cancel/options';

// 获取所有城市
const CITYS_ALL = 'cities/all';

// 获取城市下所属区域
const DISTRICTS = 'districts/list-by-city-id/';

// 申请废单
const CANCEL_ORDER = 'customer/order/cancel';

// 确认服务
const CONFIRM_SERVICE = 'customer/confirm-service';

// 获取设计师个人资料
const DESIGNER_USER_INFO = 'user/info';

// 活动记录
const ACTION_LOG = 'app-log/save';

// 退出登录
const LOGOUT = 'user/logout';

// 登录
const CODE_LOGIN = 'user/code/login';

// 注册并发送验证码
const REGISTER_SEND_CODE = 'user/q-open/register-send-code';

// 验证码
const CAPTCHA_CODE = 'user/captchaCode';

// 获取openId
const GET_OPEN_ID = 'user/getWxOpenIdByCode';

// 手机验证码
const SMS_CAPTCHA_CODE = 'user/erp/password/sms';

// 修改密码
const SET_PSW = 'user/erp/set/password';

// 获取验证码
const GET_CAPTCHA_CODE = 'q-open/captcha';

// 获取接单趋势
const GET_SHOP_RECEIVED_INFO = 'data/report/search-shop-received-info';

// 获取该城市接单排名
const GET_RECEIVED_RANK_THIS_CITY = 'data/report/search-city-received-info';

// 获取口碑排名
const GET_KOUBEI_RANK_TREND = 'trend/rank';

// 获取联系结果选项
const GET_CONTACT_OPTIONS = 'customer/contact/options';

const SAVE_CONTACT_RECORD = 'customer/contact/record';

// 资源包
const RESOURCE_PACKET = 'resource/packet';

// 资源包购买明细
const PACKET_ORDER = 'packet/order';

// 充值明细
const RECHARGE_LIST = 'shop/get-shop-recharge';
const SHOP_BALANCE = 'shop/get-shop-balance';
const APP_ACTION_LOG = 'app-action-log';
const RESOURCE_PACKET_BID = 'resource/packet/bid';
const RESOURCE_PACKET_BID_NOTIFY = 'resource/packet/bid/notify';
const RESOURCE_PACKET_BID_CONFIG = 'resource/packet/bid-config';
const RESOURCE_PACKET_BID_MINE = 'resource/packet/bid/mine';

// 置顶文本
const TOP_BAR_TEXT = 'notice-text/top-bar';

function obj2uri(obj) {
  function concatenate(k) {
    return `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`;
  }

  return Object.keys(obj).map(concatenate).join('&');
}

function getCustomerList(o) {
  return `${HOST_URI}${CUSTOMER_LIST}?${obj2uri(o)}`;
}

function getCaptchaCode() {
  return `${HOST_URI}${CAPTCHA_CODE}`;
}

function getCustomerDetail(o) {
  return `${HOST_URI}${CUSTOMER_DETAIL}${o}`;
}

function pickOrder(x, y) {
  return `${HOST_URI}${PICK_ORDER}${x}/${y}`;
}

function getCustomerPhone(o) {
  return `${HOST_URI}${CUSTOMER_PHONE}${o}`;
}

function getCancelOrderOptions() {
  return `${HOST_URI}${CANCEL_ORDER_OPTIONS}`;
}

function getCitysAll() {
  return `${HOST_URI}${CITYS_ALL}`;
}

function getDistricts(o) {
  return `${HOST_URI}${DISTRICTS}${o}`;
}

function cancelOrder(o) {
  return `${HOST_URI}${CANCEL_ORDER}?${obj2uri(o)}`;
}

function confirmService() {
  return `${HOST_URI}${CONFIRM_SERVICE}`;
}

function getDesignerUserInfo() {
  return `${HOST_URI}${DESIGNER_USER_INFO}`;
}

function recordActionLog() {
  return `${HOST_URI}${ACTION_LOG}`;
}

function logout() {
  return `${HOST_URI}${LOGOUT}`;
}

function login() {
  return HOST_URI + LOGIN;
}

function codeLogin() {
  return HOST_URI + CODE_LOGIN;
}

function qopenRegisterAndSendCode() {
  return HOST_URI + REGISTER_SEND_CODE;
}

function getOpenId(code) {
  return `${HOST_URI}${GET_OPEN_ID}/${code}`;
}

function getSmsCaptchaCode() {
  return `${HOST_URI}${SMS_CAPTCHA_CODE}`;
}

function setPassword() {
  return `${HOST_URI}${SET_PSW}`;
}

function getImgCaptchaCode() {
  return `${HOST_URI}${GET_CAPTCHA_CODE}`;
}

function pushOrderList() {
  return `${HOST_URI}${PUSH_ORDER_LIST}`;
}

function getReceivedRankThisCity() {
  return `${HOST_URI}${GET_RECEIVED_RANK_THIS_CITY}`;
}

function getReceivedInfoThisShop() {
  return `${HOST_URI}${GET_SHOP_RECEIVED_INFO}`;
}

function getKoubeiRankTrend() {
  return `${HOST_URI}${GET_KOUBEI_RANK_TREND}`;
}

function getContactOptions() {
  return `${HOST_URI}${GET_CONTACT_OPTIONS}`;
}

function saveContactRecord() {
  return `${HOST_URI}${SAVE_CONTACT_RECORD}`;
}

function getResourcePacketList() {
  return `${HOST_URI}${RESOURCE_PACKET}`;
}

function getResourcePacketDetail(o) {
  return `${HOST_URI}${RESOURCE_PACKET}/${o}`;
}

function getRechargeList() {
  return `${HOST_URI}${RECHARGE_LIST}`;
}

function getShopBalance() {
  return `${HOST_URI}${SHOP_BALANCE}`;
}

function getPacketOrderList() {
  return `${HOST_URI}${PACKET_ORDER}`;
}

function reservePacketOrder() {
  return `${HOST_URI}${PACKET_ORDER}/reserve`;
}

function addAppActionLog() {
  return `${HOST_URI}${APP_ACTION_LOG}`;
}

function resourcePacketBid() {
  return `${HOST_URI}${RESOURCE_PACKET_BID}`;
}

function resourcePacketBidNotify() {
  return `${HOST_URI}${RESOURCE_PACKET_BID_NOTIFY}`;
}

function findPacketBidByCompany(o) {
  return `${HOST_URI}${RESOURCE_PACKET_BID}?${obj2uri(o)}`;
}

function getPacketBidConfig() {
  return `${HOST_URI}${RESOURCE_PACKET_BID_CONFIG}`;
}

function getPacketBidDetail(o) {
  return `${HOST_URI}${RESOURCE_PACKET_BID}/${o}`;
}

function findMyBidList() {
  return `${HOST_URI}${RESOURCE_PACKET_BID_MINE}`;
}

function getTopBarText() {
  return `${HOST_URI}${TOP_BAR_TEXT}`;
}

function getIndexBanner(){
  return `${HOST_URI}${INDEX_BANNER}`;
}

function getGoodsClass() {
  return `${HOST_URI}${GOODS_CLASS}`;
}

function getGoodsList() {
  return `${HOST_URI}${GOODS_LIST}`;
}

function getGoodsDetail() {
  return `${HOST_URI}${GOODS_DETAIL}`;
}

function getRelatedGoods(){
  return `${HOST_URI}${GOODS_RELATED}`;
}

function getHotWord() {
  return `${HOST_URI}${HOT_WORD}`;
}

function getIndexList() {
  return `${HOST_URI}${INDEX_GROUP}`;
} 

function getGroupList() {
  return `${HOST_URI}${GROUP_LIST}`;
}

function getIndexRecommend(){
  return `${HOST_URI}${GOODS_INDEX_RECOMMEND}`;
}

function getRecommendList(){
  return `${HOST_URI}${RECOMMEND_LIST}`;
}

function getGoodsCar(){
  return `${HOST_URI}${CAR_INFO}`;
}

function getAddressEdit(){
  return `${HOST_URI}${ADDRESS_EDIT}`;
}

function getRegion(){
  return `${HOST_URI}${REGION}`;
}

function getUserAddressList(){
  return `${HOST_URI}${USER_ADDRESS}`;
}


function getUserAddressDelete() {
  return `${HOST_URI}${ADDRESS_DELETE}`;
}

function getPlaceOrder() {
  return `${HOST_URI}${PLACE_ORDER}`;
}

function getAddGoodsCar() {
  return `${HOST_URI}${GOODS_ADD_CAR}`;
}

function getOrderList() {
  return `${HOST_URI}${ORDER_LIST}`;
}

function getCouponList(){
  return `${HOST_URI}${COUPON_LIST}`;
}

function getOrderDetail(){
  return `${HOST_URI}${ORDER_DETAIL}`;
}

function getOrderCancel() {
  return `${HOST_URI}${ORDER_CANCEL}`;
}


function getCarNum(){
  return `${HOST_URI}${CAR_NUM}`;
}

function getSpecialList(){
  return `${HOST_URI}${SPECIAL_LIST}`;
}

function getSpecialDetail() {
  return `${HOST_URI}${SPECIAL_DETAIL}`;
}

function getSpecialGoods(){
  return `${HOST_URI}${SPECIAL_GOODS}`;
}

function getPromList(){
  return `${HOST_URI}${PROM_LIST}`;
}

function getPromDetail() {
  return `${HOST_URI}${PROM_DETAIL}`;
}

function getPromGoods() {
  return `${HOST_URI}${PROM_GOODS}`;
}

function getGoodsSearchType() {
  return `${HOST_URI}${GOODS_SEARCH_TYPE}`;
}

function getSessionKey() {
  return `${HOST_URI}${GET_SESSION_KEY}`;
}


function login4OpenId() {
  return `${HOST_URI}${GET_USER_FOR_OPENID}`;
}

function wxPay() {
  return `${HOST_URI}${WX_PAY}`;
}

function delShopCar() {
  return `${HOST_URI}${DEL_SHOP_CAR}`;
}

function confirmOrder() {
  return `${HOST_URI}${ORDER_CONFIRM}`;
}



module.exports.getCustomerList = getCustomerList;
module.exports.getCustomerDetail = getCustomerDetail;
module.exports.pickOrder = pickOrder;
module.exports.getCustomerPhone = getCustomerPhone;
module.exports.getCancelOrderOptions = getCancelOrderOptions;
module.exports.cancelOrder = cancelOrder;
module.exports.getCitysAll = getCitysAll;
module.exports.getDistricts = getDistricts;
module.exports.confirmService = confirmService;
module.exports.getDesignerUserInfo = getDesignerUserInfo;
module.exports.recordActionLog = recordActionLog;
module.exports.logout = logout;
module.exports.login = login;
module.exports.codeLogin = codeLogin;
module.exports.qopenRegisterAndSendCode = qopenRegisterAndSendCode;
module.exports.getCaptchaCode = getCaptchaCode;
module.exports.getOpenId = getOpenId;
module.exports.getSmsCaptchaCode = getSmsCaptchaCode;
module.exports.setPassword = setPassword;
module.exports.getImgCaptchaCode = getImgCaptchaCode;
module.exports.pushOrderList = pushOrderList;
module.exports.getReceivedRankThisCity = getReceivedRankThisCity;
module.exports.getReceivedInfoThisShop = getReceivedInfoThisShop;
module.exports.getKoubeiRankTrend = getKoubeiRankTrend;
module.exports.getContactOptions = getContactOptions;
module.exports.saveContactRecord = saveContactRecord;
module.exports.getResourcePacketList = getResourcePacketList;
module.exports.getResourcePacketDetail = getResourcePacketDetail;
module.exports.getPacketOrderList = getPacketOrderList;
module.exports.reservePacketOrder = reservePacketOrder;
module.exports.getRechargeList = getRechargeList;
module.exports.getShopBalance = getShopBalance;
module.exports.addAppActionLog = addAppActionLog;
module.exports.resourcePacketBid = resourcePacketBid;
module.exports.resourcePacketBidNotify = resourcePacketBidNotify;
module.exports.findPacketBidByCompany = findPacketBidByCompany;
module.exports.getPacketBidConfig = getPacketBidConfig;
module.exports.getPacketBidDetail = getPacketBidDetail;
module.exports.findMyBidList = findMyBidList;
module.exports.getTopBarText = getTopBarText;

module.exports.getIndexBanner = getIndexBanner;
module.exports.getGoodsClass = getGoodsClass;
module.exports.getGoodsList = getGoodsList;
module.exports.getGoodsDetail = getGoodsDetail;
module.exports.getRelatedGoods = getRelatedGoods;
module.exports.getHotWord = getHotWord;
module.exports.getIndexList = getIndexList;
module.exports.getGroupList = getGroupList;
module.exports.getIndexRecommend = getIndexRecommend;
module.exports.getRecommendList = getRecommendList;
module.exports.getGoodsCar = getGoodsCar;
module.exports.getAddressEdit = getAddressEdit;
module.exports.getRegion = getRegion;
module.exports.getUserAddressList = getUserAddressList;
module.exports.getUserAddressDelete = getUserAddressDelete;
module.exports.getPlaceOrder = getPlaceOrder;
module.exports.getAddGoodsCar = getAddGoodsCar;
module.exports.getOrderList = getOrderList;
module.exports.getCouponList = getCouponList;
module.exports.getOrderDetail = getOrderDetail;
module.exports.getCarNum = getCarNum;
module.exports.getSpecialList = getSpecialList;
module.exports.getSpecialDetail = getSpecialDetail;
module.exports.getSpecialGoods = getSpecialGoods;
module.exports.getPromList = getPromList;
module.exports.getPromDetail = getPromDetail;
module.exports.getPromGoods = getPromGoods;
module.exports.getGoodsSearchType = getGoodsSearchType;
module.exports.getSessionKey = getSessionKey;
module.exports.login4OpenId = login4OpenId;
module.exports.wxPay = wxPay;
module.exports.delShopCar = delShopCar;
module.exports.getOrderCancel = getOrderCancel;
module.exports.confirmOrder = confirmOrder;